import org.apache.spark.sql.SparkSession
object Union {
  def main(args: Array[String]): Unit = {
    val spark = SparkSession.builder()
      .appName("Test")
      .master("local[*]")
      .getOrCreate()
    val sc = spark.sparkContext

    val rdd1 = sc.parallelize(List(('a', 1),('b', 2),('c', 3)))
    val rdd2 = sc.parallelize(List(('a', 1),('d', 4),('e', 5)))

    println(rdd1.union(rdd2).collect)
  }
}
